import type { ArrayTableObj, tableTypePage } from "./model/index";
import service from "@/utils/request";
enum Api {
  PathbrandList = "/admin/product/baseTrademark/getTrademarkList",
  PathbrandListPage = "/admin/product/baseTrademark",
  addBrandUrl = "/admin/product/baseTrademark/save",
  removeBrandUrl = "/admin/product/baseTrademark/remove",
  changeBrandUrl = "/admin/product/baseTrademark/update",
}
export function reqBrandList() {
  return service.get<null, ArrayTableObj>(
    "/admin/product/baseTrademark/getTrademarkList"
  );
}

export function reqBrandListPage(page: number, limit: number) {
  return service.get<null, tableTypePage>(
    `${Api.PathbrandListPage}/${page}/${limit}`
  );
}
// POST /admin/product/baseTrademark/save
export function reqAddBrand(tmName: string, logoUrl: string) {
  return service.post<null, any>(Api.addBrandUrl, { logoUrl, tmName });
}
export function reqRemoveBrand(id: string) {
  return service.delete<null, any>(Api.removeBrandUrl + `/${id}`);
}
export function reqChangeBrand(
  id: number | string,
  logoUrl: string,
  tmName: string
) {
  return service.put<null, any>(Api.changeBrandUrl, { id, logoUrl, tmName });
}
